#include "prec.h"

#include "rtcontrol.h"

static wxiWorkerManager* s_workerManager = NULL;

void RTC_Init(int initthread, int maxthread)
{
	if (!s_workerManager)
		s_workerManager = new wxiWorkerManager(initthread, maxthread);
}

void RTC_Exit()
{
	if (s_workerManager)
	{
		delete s_workerManager;
		s_workerManager = NULL;
	}
}

void RTC_AddTask(wxiTask* task)
{
	wxASSERT(task != NULL);

	if (s_workerManager)
	{
		s_workerManager->AppendTask(task);
	}
	else
	{
		if (task->ShouldDelete())
		{
			delete task;
			task = NULL;
		}
	}
}
